<?php

namespace App\Http\Controllers\admin;

use App\Dao\UsersDao;
use App\Services\Code;

class UsersController extends BaseController
{
    public function users(){
        if(getIsHasPage()){
            return  Code::message('',200,UsersDao::pageUsers(request()->all()));
        }
        return view('admin.users.users');
    }
    public function recharge()
    {
        UsersDao::rechargeAdmin(request()->all());
        return Code::message('',200);
    }
    public function edit()
    {
        if(isPost()){
            UsersDao::editInfo(request()->all());
            return  Code::message();
        }
        $info = UsersDao::builder_query(['user_id'=>request('user_id')])->first()->toArray();
        return view('admin.users.edit',[
            'info'=>$info
        ]);
    }
}
